var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("BaseModuleUI"),
    a = e("GlobalParams"),
    i = e("AudioManager"),
    r = e("CommonHelper"),
    s = e("RoleSoldierInfo"),
    l = e("AD"),
    c = cc._decorator,
    d = c.ccclass,
    h = c.property,
    _ = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.skill_name = null),
                (t.skill_info = null),
                (t.skill_cooling_time = null),
                (t.skill_node = null),
                (t.choose_skill = [1, 2]),
                t
            );
        }
        return (
            __extends(t, e),
            (t.prototype.initView = function () {
                this.showChooseSkillInfo(), this.showSkillInfo(2);
            }),
            (t.prototype.OnClick = function (t) {
                var o = this;
                e.prototype.OnClick.call(this, t);
                var n = t.node.name;
                switch (n) {
                    case "skill_1":
                    case "skill_2":
                    case "skill_3":
                    case "skill_4":
                    case "skill_5":
                    case "skill_6":
                        var s = Number(r.default.getNameType(n, "skill_")),
                            c = function () {
                                if (o.choose_skill[1] != s) {
                                    var e = [o.choose_skill[1], s];
                                    (o.choose_skill = e),
                                        (a.GlobalParams.MatchGamePlayer[a.GlobalParams.MatchMyIndex].player_skill =
                                            o.choose_skill);
                                }
                                o.showSkillInfo(s);
                            },
                            d = a.GlobalParams.PlayerInfo.value;
                        -1 != d.unlock_skill.indexOf(s) || l.default.getInstance().getGameTestVersion()
                            ? c()
                            : l.default.getInstance().showVideo(function (e) {
                                  i.default.playGameBGM(),
                                      e == l.ResultEnum.Success &&
                                          (d.unlock_skill.push(s), (a.GlobalParams.PlayerInfo.value = d), c());
                              });
                }
            }),
            (t.prototype.showSkillInfo = function (e) {
                var t = s.default.Player_Skill_Info[e - 1];
                (this.skill_name.string = t.name),
                    (this.skill_info.string = t.skill_info),
                    (this.skill_cooling_time.string = t.cooling + "秒"),
                    this.showChooseSkillInfo();
            }),
            (t.prototype.showChooseSkillInfo = function () {
                for (var e = a.GlobalParams.PlayerInfo.value, t = 0; t < this.skill_node.childrenCount; t++)
                    (this.skill_node.children[t].children[0].active = -1 != this.choose_skill.indexOf(t + 1)),
                        (this.skill_node.children[t].children[1].active =
                            -1 == e.unlock_skill.indexOf(t + 1) && !l.default.getInstance().getGameTestVersion());
            }),
            __decorate([h(cc.Label)], t.prototype, "skill_name", void 0),
            __decorate([h(cc.Label)], t.prototype, "skill_info", void 0),
            __decorate([h(cc.Label)], t.prototype, "skill_cooling_time", void 0),
            __decorate([h(cc.Node)], t.prototype, "skill_node", void 0),
            __decorate([d], t)
        );
    })(n.default);
o.default = _;
